package Makeshift.example.sub.builder;

// Changes to this file immediately affect the next build.  Treat it as a build script.


/** The software builder proper to this example project.
  */
public final class Builder extends Makeshift.BuilderDefault<Target> {


    public Builder() { super( Target.class, "Makeshift.example.sub" ); }



   // ━━━  B u i l d e r  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━


    public @Override void build( final String targ ) throws Makeshift.Project.UserError {
        final String target = Makeshift.Builder.matchingTargetName( targ, Target.class );
        switch( target ) {
            case "custom" -> buildTo_custom();
            default -> super.buildTo( target ); }}



////  P r i v a t e  ////////////////////////////////////////////////////////////////////////////////////


    /** Pretends to build target `custom`.
      */
    private void buildTo_custom() {
        Makeshift.example.top.Helper.help( projectPackage() ); /* Accessible because the project
          that defines it is included in the present project’s `BuilderBuilder.externalBuildingCode`. */
        Makeshift.Project.printProgressLeader( projectPackage(), "subB" );
        System.out.println( 1 ); }}



                                                        // Copyright © 2020  Michael Allan.  Licence MIT.