Skip to content

Commit

Permalink
Automates the BootsFaces version number change in Java code when buil…
Browse files Browse the repository at this point in the history
…ding with Gradle ( #555 )
  • Loading branch information
TheCoder4eu committed Dec 11, 2016
1 parent 25f4966 commit 874a0f5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Properties props = new Properties()
props.load(new FileInputStream("${projectDir}/build.properties"))
ext.BootsFacesVersion = props['VERSION']
ext.BootsFacesReleaseStatus = props['RELEASE-STATUS'] //SNAPSHOT or RELEASE
//Bootstrap
ext.BootstrapVersion = props['bootstrap.version']
//PatternFly
Expand Down Expand Up @@ -79,5 +80,13 @@ task showConfig {
println "--------------------"
}
}
showConfig.doFirst {
String configClassFile='src/main/java/net/bootsfaces/C.java'
String configClass = new File( configClassFile ).getText( 'UTF-8' )
configClass=(configClass =~ /BSFVERSION\s*\=\s*\"[v0-9\.]*\"/).replaceFirst('BSFVERSION="'+BootsFacesVersion+'"')
configClass=(configClass =~ /BSFRELEASE_STATUS\s*\=\s*\"\w*\"/).replaceFirst('BSFRELEASE_STATUS="'+BootsFacesReleaseStatus+'"')
//println configClass
new File( configClassFile ).write( configClass, 'UTF-8' )
}

defaultTasks 'showConfig', ':java6:defaultJar', ':java7:jar', ':java8:jar'
1 change: 1 addition & 0 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# is an escape character followed by a control character.
#########################################################################################################
VERSION=1.0.1
RELEASE-STATUS=SNAPSHOT
bootstrap.version=3.3.7

# Set global properties for this build
Expand Down
30 changes: 16 additions & 14 deletions src/main/java/net/bootsfaces/C.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Copyright 2013-2016 Riccardo Massera (TheCoder4.Eu)
*
*
* This file is part of BootsFaces.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -21,39 +21,41 @@

/**
* String Constants valid for the whole Framework
*
*
* @author thecoder4.eu
*/
public final class C {
/**
* BootsFaces Library Constants
*/
public static final String BSFCOMPONENT= "net.bootsfaces.component";
public static final String BSFLAYOUT = "net.bootsfaces.layout";
//public static final String BSFRENDER = "net.bootsfaces.render";

public static final String BSFVERSION="1.0.1";
public static final String BSFRELEASE_STATUS="SNAPSHOT"; //SNAPSHOT or RELEASE
public static final String BSFCOMPONENT= "net.bootsfaces.component";
public static final String BSFLAYOUT = "net.bootsfaces.layout";
//public static final String BSFRENDER = "net.bootsfaces.render";

//Theme
public static final String BSF_LIBRARY="bsf";
public static final String P_USETHEME ="BootsFaces_USETHEME";
public static final String P_THEME ="BootsFaces_THEME";

//Font Awesome
//public static final String P_USEFONTAWESOME ="BootsFaces_USE_FA";
public static final String FA_VERSION="4.7.0";
public static final String FONTAWESOME_CDN_URL="//maxcdn.bootstrapcdn.com/font-awesome/"+FA_VERSION+"/css/font-awesome.min.css";

//Meta tags
// default yes. to disable set to 'no' or 'false'. if you want to change, set to the value you want to use
public static final String P_VIEWPORT = "BootsFaces_USE_VIEWPORT";
// default yes. to disable set to 'no' or 'false'. if you want to change, set to the value you want to use
public static final String P_VIEWPORT = "BootsFaces_USE_VIEWPORT";

/**
* Component Types
*/
//Components
public static final String W_NONAVCASE_LINK="This link is disabled because a navigation case could not be matched.";
public static final String W_NONAVCASE_BUTTON="This link is disabled because a navigation case could not be matched.";


// Suppress default constructor for noninstantiability
private C() {
throw new AssertionError();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public class AddResourcesListener implements SystemEventListener {
CSS_RENDERER = "javax.faces.resource.Stylesheet";

static {
LOGGER.info("This application is running on BootsFaces 1.0.1-SNAPSHOT");
LOGGER.info("This application is running on BootsFaces"+C.BSFVERSION+"-"+C.BSFRELEASE_STATUS);
//LOGGER.info("This application is running on BootsFaces 1.0.1-SNAPSHOT");
}

/**
Expand Down

0 comments on commit 874a0f5

Please sign in to comment.