Toggle navigation
?
users online
Logout
Open hangout
Open chat for current file
% Define which licenses are viral (they "infect" the whole project) viral(gpl). % Define compatibility (who can include whom) compatible(mit, mit). compatible(apache, mit). compatible(apache, apache). compatible(gpl, _). % GPL can include anything % Your app's dependency tree (declare as dynamic so we can modify) :- dynamic uses/3. uses(myapp, react, mit). uses(myapp, tensorflow, apache). uses(tensorflow, helper_lib, gpl). % Ouch! % Find viral infections recursively % A project is "infected" if it uses GPL directly or indirectly infected(Project) :- uses(Project, _, License), viral(License). % Direct GPL dependency infected(Project) :- uses(Project, Dep, _), infected(Dep). % Transitive GPL dependency % The key question: Can we keep it proprietary? % Only if we're NOT infected by a viral license can_be_proprietary(Project) :- \+ infected(Project). % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Start querying the license checker! % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % can_be_proprietary(myapp). % infected(myapp). % uses(myapp, What, _), infected(What). % uses(tensorflow, What, License), viral(License). % retract(uses(tensorflow, helper_lib, gpl)), % assertz(uses(tensorflow, helper_lib, mit)), % can_be_proprietary(myapp). % infected(What). % uses(_, _, License). % uses(What, _, gpl).