IntelliJ Themes: added Java 9 module descriptor to flatlaf-intellij-themes-<version>.jar

This commit is contained in:
Karl Tauber
2020-04-27 18:25:49 +02:00
parent 129bc9b3ae
commit 44c455419b
6 changed files with 67 additions and 6 deletions

View File

@@ -11,6 +11,8 @@ FlatLaf Change Log
other themes.
- IntelliJ Themes: Material UI Lite themes did not work when using
[IntelliJ Themes Pack](flatlaf-intellij-themes) addon. (PR #88, issue #89)
- IntelliJ Themes: Added Java 9 module descriptor to
`flatlaf-intellij-themes-<version>.jar`.
## 0.32

View File

@@ -86,7 +86,7 @@ public class IntelliJTheme
* Using a buffered input stream is not necessary.
*/
public static FlatLaf createLaf( InputStream in )
throws IOException, ParseException
throws IOException
{
return createLaf( new IntelliJTheme( in ) );
}
@@ -106,11 +106,13 @@ public class IntelliJTheme
*/
@SuppressWarnings( "unchecked" )
public IntelliJTheme( InputStream in )
throws IOException, ParseException
throws IOException
{
Map<String, Object> json;
try( Reader reader = new InputStreamReader( in, StandardCharsets.UTF_8 ) ) {
json = (Map<String, Object>) Json.parse( reader );
} catch( ParseException ex ) {
throw new IOException( ex.getMessage(), ex );
}
name = (String) json.get( "name" );

View File

@@ -25,6 +25,18 @@ dependencies {
implementation( project( ":flatlaf-core" ) )
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
sourceSets {
create( "module-info" ) {
java {
// include "src/main/java" here to get compile errors if classes are
// used from other modules that are not specified in module dependencies
setSrcDirs( listOf( "src/main/module-info", "src/main/java" ) )
}
}
}
}
tasks {
assemble {
dependsOn(
@@ -33,6 +45,26 @@ tasks {
)
}
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
named<JavaCompile>( "compileModuleInfoJava" ) {
sourceCompatibility = "9"
targetCompatibility = "9"
dependsOn( ":flatlaf-core:jar" )
options.compilerArgs.add( "--module-path" )
options.compilerArgs.add( project( ":flatlaf-core" ).tasks["jar"].outputs.files.asPath )
}
}
jar {
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
from( sourceSets["module-info"].output ) {
include( "module-info.class" )
}
}
}
javadoc {
options {
this as StandardJavadocDocletOptions

View File

@@ -21,7 +21,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.IntelliJTheme;
import com.formdev.flatlaf.json.ParseException;
/**
* @author Karl Tauber
@@ -34,7 +33,7 @@ class Utils
try {
return new IntelliJTheme( Utils.class.getResourceAsStream(
"/com/formdev/flatlaf/intellijthemes/themes/" + name ) );
} catch( ParseException | IOException ex ) {
} catch( IOException ex ) {
String msg = "FlatLaf: Failed to load IntelliJ theme '" + name + "'";
LOG.log( Level.SEVERE, msg, ex );
throw new RuntimeException( msg, ex );

View File

@@ -21,7 +21,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.IntelliJTheme;
import com.formdev.flatlaf.json.ParseException;
/**
* @author Karl Tauber
@@ -34,7 +33,7 @@ class Utils
try {
return new IntelliJTheme( Utils.class.getResourceAsStream(
"/com/formdev/flatlaf/intellijthemes/themes/material-theme-ui-lite/" + name ) );
} catch( ParseException | IOException ex ) {
} catch( IOException ex ) {
String msg = "FlatLaf: Failed to load IntelliJ theme '" + name + "'";
LOG.log( Level.SEVERE, msg, ex );
throw new RuntimeException( msg, ex );

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2020 FormDev Software GmbH
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Karl Tauber
*/
module com.formdev.flatlaf.intellijthemes {
requires java.desktop;
requires java.logging;
requires com.formdev.flatlaf;
exports com.formdev.flatlaf.intellijthemes;
exports com.formdev.flatlaf.intellijthemes.materialthemeuilite;
}