Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import java.io.*;
import org.litesoft.core.typeutils.Objects;
import java.util.*;

import com.esotericsoftware.scar.*;

import static com.esotericsoftware.minlog.Log.*;

public class Builder
{
    // Magic Property Values:

    private static final String NAME = "name"; //. . . . . . . . . The name of the project. Used to name the JAR. Default: The name of the directory containing the project YAML file.
    private static final String TARGET = "target"; //. . . . . . . The directory to output build artifacts.   Default: The directory containing the project YAML file, plus "../target/name".
    private static final String VERSION = "version"; //. . . . . . The version of the project. If available, used to name the JAR.   Default: blank
    private static final String RESOURCES = "resources"; //. . . . Wildcard patterns for the files to include in the JAR.   Default: resources and src/main/resources.
    private static final String DIST = "dist"; //. . . . . . . . . Wildcard patterns for the files to include in the distribution, outside the JAR.   Default: dist.
    private static final String SOURCE = "source"; //. . . . . . . Wildcard patterns for the Java files to compile.   Default: src **/*.java and src/main/java **/*.java.
    private static final String CLASSPATH = "classpath"; //. . . . Wildcard patterns for the files to include on the classpath.   Default: lib **/*.jar.
    private static final String DEPENDENCIES = "dependencies"; //. Relative or absolute paths to dependency project directories or YAML files.   Default: blank
    private static final String INCLUDE = "include"; //. . . . . . Relative or absolute paths to project files to inherit properties from.   Default: blank
    private static final String MAIN = "main"; //. . . . . . . . . Name of the main class.   Default: blank

    private static final String DEPENDS = "depends"; //. . . . . . List of "Functional" dependencies (e.g. litesoft).   Default: blank
    private static final String DEV_ROOT_DIR = "DevRootDir"; //. . Relative Path to the Dev Root Dir (where litesoft and zGlobal) can be found.   Default: blank    Only required if "depends"="litesoft" / mode="GWT" is specified.
    private static final String MODE = "mode"; //. . . . . . . . . Mode of this Project.   Default: JAR   for options, see below...
    // Mode options are (case ignored):
    //      JAR - package this project into a regular JAR
    //      1JAR - package this project into a Single JAR (including the contents of all the dependant JARs)
    //      Web - package this project into a WAR folder
    //      War - package this project into a WAR file (Web implied)
    //      GWT(xxx) - package this project into a WAR file, AND include the GWT support code.  The "xxx" indicates the path and name of the xxx.gwt.xml file.
    //          After the closing ')' you can optionally specify one from each (comma separated) of the following groups (first listed is the default):
    //              LogLevel:                               Style:
    //              WARN                                    OBF
    //              DEBUG                                   PRETTY
    //                                                      DETAIL
    //  a full GWT example:
    //
    //      mode=GWT(org.sample.MyGwtApplication)Debug,Detail

    private boolean mBuilt = false;
    private Builder mParent = null;
    private List<Builder> mDependents = new ArrayList<Builder>();
    private Project mProject = new Project();
    private String mName;

    public Builder( Builder pParent, String pYamlPath )
            throws IOException
    {
        mParent = pParent;
        mProject.load( pYamlPath );
        mName = forceName();
        processProject();
    }

    private void processProject()
    {
        //To change body of created methods use File | Settings | File Templates.
    }

    private String forceName()
    {
        String zName = mProject.get( NAME, "" ).trim();
        if ( zName.length() == 0 )
        {
            zName = new File( mProject.getDirectory() ).getName();
            mProject.set( NAME, zName );
        }
        return zName;
    }

    public void build()
    {
        for ( Builder zDependent : mDependents )
        {
            zDependent.build();
        }
        System.out.println( "build: " + mName );
    }

    public static void main( String[] args )
            throws IOException
    {
        Scar.args = new Arguments( args );

        if ( Scar.args.has( "trace" ) )
        {
            TRACE();
        }
        else if ( Scar.args.has( "debug" ) )
        {
            DEBUG();
        }
        else if ( Scar.args.has( "info" ) )
        {
            INFO();
        }
        else if ( Scar.args.has( "warn" ) )
        {
            WARN();
        }
        else if ( Scar.args.has( "error" ) ) //
        {
            ERROR();
        }

        new Builder( null, Scar.args.get( "file", "." ) ).build();
    }

    @Override
    public String toString()
    {
        return "Project: " + mName;
    }
}

Commits for litesoft/trunk/Java/Builder/src/Builder.java

Diff revisions: vs.
Revision Author Commited Message
939 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 21:30:31 +0000

Extracting commonfoundation

182 GeorgeS picture GeorgeS Sat 23 Apr, 2011 00:19:10 +0000